<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- <a href="https://www.baidu.com">baidu</a> -->
    <form name="f1" action="https://www.baidu.com">
      <input type="text" name="" id="" />
      <button type="submit">baidu</button>
    </form>
    <script>
      document.f1.onsubmit = function (e) {
        e.preventDefault();
        alert("hello");
      };
    </script>
  </body>
</html>
